Overhaul bindings generation and introduce a CLI tool#202
Merged
tschneidereit merged 9 commits intobytecodealliance:mainfrom Mar 20, 2025
Merged
Overhaul bindings generation and introduce a CLI tool#202tschneidereit merged 9 commits intobytecodealliance:mainfrom
tschneidereit merged 9 commits intobytecodealliance:mainfrom
Conversation
Member
Author
|
Note that this requires bytecodealliance/StarlingMonkey#227, bytecodealliance/StarlingMonkey#228, and bytecodealliance/StarlingMonkey#228 to work. I'll update the version of StarlingMonkey used once those have landed. With the right version of StarlingMonkey, this passes the test suite in all three build configurations for me. |
b5e3ba7 to
843aec2
Compare
Also updates Rust version in CI: StarlingMonkey now needs 1.80.0
This is a pretty large patch containing a whole bunch of changes. They're not really all related, but are hard to disentangle now, after being introduced while I worked on enabling debugging of componentize-js output. The key changes are: ## Two new CLI tools The embedding splicer now has a native Rust CLI for both splicing and stubbing. This isn't currently all that useful, but helped debug the changes to bindings generation and splicing. I plan on building on this in the future. Additionally, the full componentization has gained a CLI as an alternative to `jco componentize`, so running `npx componentize-js` will work and provide a reasonable interface. ## Support for unbundled JS A key goal of the changes here was to no longer rewrite the input source code, because that messes up debugging using StarlingMonkey's debugger. As part of implementing this, we got support for loading other JS modules at initialization time "for free", so that works now, too. ## No more treeshaking A regrettable change is that we don't support any kind of treeshaking anymore. This is much harder to implement without requiring bundled code (see the previous item). Additionally, it only worked for functions (not methods, or anything related to resources) before, and was thus of very limited value. We can in principle, with a decent amount of effort, reintroduce at least what we had before, but I think ultimately the right approach here is to make sure that the targeted runtime environment supports the full WIT world provided during componentization. ## Small stuff Aside from these larger items, there's a bunch of small changes, and fairly sizable refactorings.
843aec2 to
b3b4928
Compare
|
The error on CI is due to a not found error in the runner, incorrectly showing as a cycle error. The way to fix this is to use a newer release of Node.js that gives the proper error like Node.js 20.19 or 23.10. |
Member
Author
|
@guybedford thank you for the pointer, that was incredibly helpful! |
guybedford
approved these changes
Mar 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a pretty large patch containing a whole bunch of changes. They're not really all related, but are hard to disentangle now, after being introduced while I worked on enabling debugging of componentize-js output.
The key changes are:
Two new CLI tools
The embedding splicer now has a native Rust CLI for both splicing and stubbing. This isn't currently all that useful, but helped debug the changes to bindings generation and splicing. I plan on building on this in the future.
Additionally, the full componentization has gained a CLI as an alternative to
jco componentize, so runningnpx componentize-jswill work and provide a reasonable interface.Support for unbundled JS
A key goal of the changes here was to no longer rewrite the input source code, because that messes up debugging using StarlingMonkey's debugger. As part of implementing this, we got support for loading other JS modules at initialization time "for free", so that works now, too.
No more treeshaking
A regrettable change is that we don't support any kind of treeshaking anymore. This is much harder to implement without requiring bundled code (see the previous item). Additionally, it only worked for functions (not methods, or anything related to resources) before, and was thus of very limited value.
We can in principle, with a decent amount of effort, reintroduce at least what we had before, but I think ultimately the right approach here is to make sure that the targeted runtime environment supports the full WIT world provided during componentization.
Small stuff
Aside from these larger items, there's a bunch of small changes, and fairly sizable refactorings.